﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace UI
{
    public class WebUtils
    {

        public static void MsgBox(string strMessage)
        {

            string s;
            System.Web.UI.Page p;
            try
            {
                if (HttpContext.Current == null) return;
                s = "<script type=\"text/javascript\">" +
                Environment.NewLine + "<!--" + Environment.NewLine +
                "alert('" + strMessage.Replace("\"", "\\\"") + "');" +
                Environment.NewLine + "// --></script>";
                p = (System.Web.UI.Page)HttpContext.Current.Handler;
                if (!(p.IsStartupScriptRegistered("MsgBox")))
                    p.RegisterStartupScript("MsgBox", s.ToString());
            }
            catch (Exception ex)
            {
                
            }
        }

    }
}